home *** CD-ROM | disk | FTP | other *** search
- Subject: Re:Undo Set Property
- Sent: 8/7/96 3:45 PM
- Received: 8/7/96 3:43 PM
- From: Greg Friedman, friedman@cognosis.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Greg Friedman wrote (in response to Serge) :
- > > May I suggest that FW_CPropertyDesignator call a method of FW_CPart to
- > > create the FW_CSetPropertyCommand? If you can do this or something similar
- > > for ODF 2, I will file my incomplete Undo support as a bug to be corrected
- > > once ODF 2 is out.
- >
- > This is a good suggestion, though I think it should be a virtual method of
- > FW_MScriptable, not of FW_CPart.
-
- I've thought more about this, and examined a couple of possible designs. In
- the end, I think the best bet is to stick with the current implementation,
- with one minor addition. I'll explain the thinking behind not adding a
- method first, and then I'll explain the modification that I am making.
-
- FW_CSetPropertyCommand has a very close relationship with
- FW_CPropertyDesignator. Much of the code in FW_CPropertyDesignator exists
- to deal with issues related to multiple undo and clearing of the undo
- stack. A close read of this code will reveal that designators become
- "dependent" on the objects they reference, and vice versa. There is a
- mechanism in place for bidrectional notification to prevent dangling
- pointers when objects are deleted that have undoable commands on the undo
- stack.
-
- What Serge wants to do is perfectly acceptable, but I think it is unusual
- and does not represent what 80% or more of ODF users need to do.
- Furthermore, I think the likelihood of introducing bugs by trying to
- replace the functionality of the SetPropertyCommand is high. It took quite
- a bit of work to iron out these classes, and to make them work correctly
- within the world of multiple undo and the undo stack.
-
- What I am doing: I am adding a new method called
- FW_MScriptable::SaveProperty. This method will be called by
- FW_CSetPropertyCommand in the place of GetProperty. By default, this method
- will just call GetProperty. I believe this should provide a solution for
- Serge.
-
- Currently, there is no way to distinguish between a GetProperty call
- resulting from an AppleScript request for a property versus a call by
- FW_CSetPropertyCommand for the purpose of saving a property value for redo.
- In the former case, you always want to return just the property value the
- user requested. In the latter case, you may want to save additional state
- information for redo (perhaps other properties, or private data).
-
- With the new method, you can put whatever private data you want into the
- FW_CDesc passed to SaveProperty. If you want to save more than a single
- property, you can make the descriptor into a record, and put whatever you
- want into it.
-
- This mechanism should make the GetProperty undo mechanism more flexible,
- while still relying on the existing property designator and set property
- command.
-
- ODF users who insist on using a mechanism other than the built in property
- designator and set property command should override
- FW_MScriptable::GetContainedObject and, in the case of a property request,
- return something other than an FW_CPropertyDesignator. There is nothing
- preventing this in ODF 1 or ODF 2.
-
- Greg.
-
-
- ___________________________________________________________
- Greg Friedman ODF Engineering Apple Computer
-
-
-